/******************************************************************************/
/*                                                                            */
/*  Copyright (c) 2009: ngi-central.org                                       */
/*  All rights reserved.                                                      */
/*                                                                            */
/******************************************************************************/


#include <boost/test/unit_test.hpp>

#include "..\..\include\sgl\bounding_box.h"
#include "..\..\include\sgl\vector.h"
#include "..\..\include\sgl\point.h"

BOOST_AUTO_TEST_SUITE( bounding_box3d )


BOOST_AUTO_TEST_CASE( bounding_box__point3d )
{
	sgl::point<3> a;

	BOOST_CHECK( bounding_box(a) == sgl::box<3>(a, sgl::vector<3>()) );

	sgl::point<3> b(1, 2, 3);

	BOOST_CHECK( bounding_box(b) == sgl::box<3>(b, sgl::vector<3>()) );
}

BOOST_AUTO_TEST_CASE( bounding_box__vector3d )
{
	sgl::vector<3> a;

	BOOST_CHECK( bounding_box(a) == sgl::box<3>(sgl::point<3>(), a) );

	sgl::vector<3> b(1, 2, 3);

	BOOST_CHECK( bounding_box(b) == sgl::box<3>(sgl::point<3>(), b) );
}

BOOST_AUTO_TEST_CASE( bounding_box__box3d )
{
	sgl::box<3> a;

	BOOST_CHECK( bounding_box(a) == sgl::box<3>() );

	sgl::box<3> b(
		sgl::point<3>(1, 2, 3),
		sgl::vector<3>(4, 5, 6));

	BOOST_CHECK( bounding_box(b) == sgl::box<3>(sgl::point<3>(1, 2, 3),
		sgl::vector<3>(4, 5, 6)) );
}

BOOST_AUTO_TEST_CASE( bounding_box__polygon3d )
{
	sgl::polygon<3> a;

	BOOST_CHECK( bounding_box(a) == sgl::box<3>() );

	sgl::polygon<3> b(
		sgl::quadrilateral<3>(
			sgl::point<3>(1, 2, 3),
			sgl::point<3>(4, 5, 6),
			sgl::point<3>(7, 8, 9),
			sgl::point<3>(10, 11, 12)));

	BOOST_CHECK( bounding_box(b) == sgl::box<3>(sgl::point<3>(1, 2, 3),
		sgl::vector<3>(9, 9, 9)) );
}


BOOST_AUTO_TEST_SUITE_END()

